package com.ruoyi.system.init;

import com.ruoyi.system.netty.TCPServerHandler;
import com.ruoyi.system.netty.TcpServer;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ITBOrderDeviceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.concurrent.CompletableFuture;

@Component
public class ServerInit implements InitializingBean {
    private static final Logger log = LoggerFactory.getLogger(ServerInit.class);

    @Autowired
    private TcpServer tcpServer;


    @Override
    public void afterPropertiesSet() throws Exception {
        log.info("初始化数据采集服务...");
        Thread nettyThread = new Thread(()->{
            tcpServer.startServer();
        });
        nettyThread.setDaemon(true);//守护线程
        nettyThread.start();
    }
}
